Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert index range check on SelectRegexReveal #218

Merged
merged 8 commits into from
Oct 10, 2024
Merged

Conversation

saleel
Copy link
Member

@saleel saleel commented Sep 8, 2024

Description

Revert index range check on SelectRegexReveal as we go with the principle of no constraining inputs in our utils and leave this to consuming functions.

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • I have discussed with the team prior to submitting this PR
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes

@@ -77,10 +79,12 @@ describe("Select Regex Reveal", () => {
} catch (error) {
expect((error as Error).message).toMatch("Assert Failed");
}

expect.assertions(1);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SoraSuegami Just FYI, we need to add this in negative testing to let jest know we expect an assertion - this ensures the catch block was executed (as our assertion is in catch). Otherwise the test would pass even if the code didn't fail as expected.


it("should fail when startIndex is larger than max length", async function () {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait why did we remove this test

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By our pattern we are constraining indices where it originates (main circuits). Adding them to each utils might be redundant as main circuits would be using multiple utils. We are not doing these checks on other circuits as well. This was added recently by another PR but we already have comments saying "assumes valid index"

@saleel
Copy link
Member Author

saleel commented Oct 1, 2024

I have reverted prettier file changes from this PR. We can do yarn lint on main once all the PRs are merged to avoid conflicts.
Should be good to merge now @Divide-By-0

@Divide-By-0 Divide-By-0 merged commit ddd09e2 into main Oct 10, 2024
5 checks passed
@saleel saleel deleted the revert/regex-update branch October 10, 2024 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants